package cn.sang.web;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.sang.model.Student;
import cn.sang.model.vo.MyListComplsitionVo;
import cn.sang.service.StudentService;
import cn.sang.util.AjaxResult;

@RequestMapping("/normal")
@Controller
public class StudentController {
	
	@Resource
	private StudentService studentService;
	
	/**
	 * 我的信息页面   查询当前登录用户所有的作文列表
	 * @param request
	 *  作文题目 , 发布日期 ,老师姓名, 得分 , 老师评语 , 批改状态 , 作文地址
	 */
	@RequestMapping("/myListComplsition.do")
	@ResponseBody
	public List<MyListComplsitionVo> myListComplsition(HttpServletRequest request){
		
		List<MyListComplsitionVo> myListComplsition = studentService.myListComplsition(request);
		return myListComplsition;
		
	}
	
	/**
	 * 获取 当前登录学生信息
	 * @param request
	 * @return
	 */
	@RequestMapping("/getStudentInfo.do")
	@ResponseBody
	public Student getStudentInfo(HttpServletRequest request){
		
		Student student = studentService.getStudentInfo(request);
		return student;
	}
	
	/**
	 * 用户登陆
	 * @param request
	 * @return
	 */
	@RequestMapping("/studentLogin.do")
	@ResponseBody
	public AjaxResult studentLogin(HttpServletRequest request){
		
		AjaxResult ajaxResult = studentService.studentLogin(request);
		return ajaxResult;
	}
	
	/**
	 * 注册
	 * @param request
	 * @return
	 */
	@RequestMapping("/studentRegister.do")
	@ResponseBody
	public AjaxResult studentRegister(HttpServletRequest request){
		AjaxResult studentRegister = studentService.studentRegister(request);
		return studentRegister;
	}
	
	
}
